Repository navigation
feat(lab): run a lab in governed mode and approve tool calls from portal dev - #1355
Conversation
…ept page as optional reading
Review recordPart of giantswarm/giantswarm#38902 (tool approval). Purpose: this repository has documentation changes only and no review of its own. This record states what was checked and which review covered it. Branch Read this first
Review rounds
Findings
Lab verificationThe agentlab binary itself was not changed. It ran all four tool-approval lab runs (bring-up, Open itemsFindings still open or partly fixed:
Never run:
|
…in handoff The portal signed in with agent-platform, the client every CLI helper and proof shares, so muster could not trust the portal for the one-time sign-in handoff without trusting them all. The lab Dex now registers agent-platform-portal with the portal's callbacks only; agent-platform, kubernetes and dex-k8s-authenticator list it under trustedPeers, so its tokens keep every audience consumers accept. Where the platform chart takes backstage.oidcClientId the lab sets it, which makes the chart list that client in muster's approval.handoffClients. The secret is the key portal-dex-client-secret of agent-platform-secrets (added to an existing Secret), and portal dev passes it as AGENT_PLATFORM_PORTAL_OIDC_CLIENT_SECRET.
… return allowlist While backstage.localDevPort is set the lab renders muster.oauth.mcpClient.postLoginRedirectAllowlist with http://localhost:3000/sessions, so the approval page returns the browser to agentlab portal dev instead of showing its own answer page. Lab only.
…nline approval muster takes the portal's inline approval decisions and sign-in handoff requests only with the portal backend's own ServiceAccount token (audience muster) beside the person's. The hot-reload portal has no projected token, so every `agentlab portal dev` mints one for the lab portal's ServiceAccount (agent-platform/backstage, TokenRequest, 12h), writes it to state/backstage-dev/muster-workload-token (0600) and points the backend's muster.workloadTokenFile at it. Without that ServiceAccount it says so and approvals open muster's own pages.
Review record — updatePart of giantswarm/giantswarm#38902. Covers only what is new since the record above (tip Read this first
Review rounds
Open items
|
Review supplement for giantswarm/giantswarm#38902Reviewed head: SpecThe lab supplies the separate portal client and workload credential required by the reviewed muster/portal interface. It is development support, not production enforcement proof. This is a scoped contract assessment, not an exhaustive numbered acceptance score. Independent focused specification cross-checks covered the core enforcement/client contracts and platform/manager integration. Declared follow-ups and accepted design changes are not counted as new defects. BlockingNo new blocking code finding established in this pass. Non-blockingNone newly established. SuggestionsNone beyond the existing review follow-ups. Deep verification
Reported checks passed or were skipped; no failed/cancelled check to triage. A skipped job is not evidence that its gate ran. Unverified locally: applicable builds, tests (including race/integration/envtest), vet, formatting/lint/pre-commit, generators, Makefile verification targets, Helm rendering/schema/unit checks, and browser/live-cluster flows. No PR code was executed. GitHub-reported CI provides supporting evidence, not a local reproduction. Recommendation: merge as-is within this review's scope, subject to existing release-order/rollout prerequisites and previously documented open items. Team context: none. |
main's dedicated portal client (backstage, #1392) replaces this branch's agent-platform-portal client; the branch keeps the local portal dev's workload token, client secret and return allowlist.
Part of giantswarm/giantswarm#38902. The review record is the first comment on this PR, with an update comment for the code added later.
What does this PR do?
Adds "Running a lab in governed mode" to
docs/platform.md. The agent-platform chart'sgovernance.modevalue (trusted, the default, orgoverned) decides whether muster also asks a person before an agent runs a write on the platform's own servers. The section shows how to set it in a lab with aplatform.valuesFilesoverlay (governance: {mode: governed}), thatagentlab statusnames the overlay and the mode, that muster reads the mode once at start so the run rolls muster, and how to go back to trusted. It also names what a dev chart needs before releases carry tool approval (floors that name dev builds, the OAuth server andmuster.muster.oauth.mcpClient.publicUrlon the lab's edge,backstage.publicPortfor a portal not on 443).One file,
docs/platform.md, +41 in the first three commits (88cca0b,5e5a267,535bb76;governanceis a map).After that the branch also makes the lab run tool approval's sign-in handoff and inline approval:
0e627e4backstageclient, #1392, in the merge8d22ec9) Dex clientagent-platform-portal(the portal's callbacks only), trusted peers onagent-platform,kubernetesanddex-k8s-authenticator, its secret inagent-platform-secrets(portal-dex-client-secret); the lab values setbackstage.oidcClientId;portal devpasses the secret;docs/identity.md5ff5c11portal devadmits the hot-reload portal's/sessionson muster's return allowlist5e61903portal devmints the portal's workload token (audiencemuster, a file, 0600) for muster's inline approval;muster.workloadTokenFilein the dev app config77b47c7a2ce1be"muster"literal inportalclient_test.goflagged bygoconstin CI8d22ec9main: main's dedicated portal clientbackstage(#1392) replacesagent-platform-portal, soportalclient.go, the second Dex client and its secret key are gone;portal devpasses thebackstageclient's secret (portal-dex-client-secret)Tip
8d22ec9.What is the effect of this change to users?
People running the lab find how to try governed mode.
portal devgets what the in-cluster portal already has onmain(its ownbackstageclient, #1392): the client's secret, the workload token and muster's return allowlist, so the hot-reload portal can use the handoff and decide approvals inline. Labs on a chart without those values are unchanged.What does it look like?
Docs for governed mode; code and docs for the portal's client and token (see above).
Any background context you can provide?
Epic giantswarm/giantswarm#38902. The agent-platform chart wires the client (
backstage.oidcClientId,muster.trustedClientsFloor); muster and the portal consume the token (linked below). Links the concept page "Governing tool calls" as optional further reading.What is needed from the reviewers?
Check that the overlay example and the steps match the current
agentlab platformbehaviour; check the Dex client's scope (portal callbacks only) and that the workload token file is not committed or logged. Known: in the lab the password connector and a constant client secret mean a password grant can mint portal-client tokens (docs wording to fix, LC-12 in the update record); the workload token is still needed to decide.Do the docs need to be updated?
This is the docs change.
Testing
The overlay mechanism (
platform.valuesFiles,platform.chartPath,platform.devImages,components.<name>.versionRange) is the one the milestone 2 and 3 lab runs used on 2026-11-26 (bring-up,agentlab platformexit 0,platform-testpassed in both runs). The governed-mode overlay itself ran in the M2 lab (governed mode: floors, exceptions and governed Ask checked). Later (2026-11-26):TestDexTemplateRegistersThePortalClientand the config and lab render subsets (go test ./internal/config ./internal/lab, portal, Dex, workload token) pass; the lab ran with the new binary through the handoff, inline approval and a final rollout (the portal signs in with its own client, the token carriesazp agent-platform-portal, the portal backend's workload token works against muster,platform-testexit 0). Known failures ininternal/labon macOS (measure, browser, git-pause, session-directory) are the same at the fork point;golangci-lintreports only the darwininternal/shaperunused findings. Not run: the full suite on another platform.Changes from the plan
Where this PR differs from the design in the epic (giantswarm/giantswarm#38902):
portal devadmits/sessionson muster's return allowlist and mints the portal's workload token, so the hot-reload portal can use the handoff and decide inline like the in-cluster one.portal devchanges above.Related pull requests